import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueDevTools from 'vite-plugin-vue-devtools'
import svgLoader from "vite-svg-loader";

export default defineConfig({ 
  plugins: [
    vue({ 
      template: { 
        compilerOptions: { 
          isCustomElement: tag => tag.startsWith('cropper-') 
        } 
      } 
    }), 
    svgLoader(), // 使用 vite-svg-loader 
    vueDevTools(), 
  ], 
  resolve: { 
    alias: { 
      '@': fileURLToPath(new URL('./src', import.meta.url)) 
    }, 
  },
  server: {
    proxy: {
      '/myAdminSystem': {
        target: 'http://localhost:9090',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/myAdminSystem/, ''),
      },
    },
  },
})
